<?php
namespace plugins\setting\model;
use think\Model;

class SettingModel extends Model
{
	/**
	 * 关联CmfSettinInfoModel
	 */
	public function settingInfo()
	{
		return $this->hasMany( 'SettingInfoModel' , 'set_id' );
	}

	/**
	 * 获取菜单
	 */
	public static function getMenuList( $parentId = 0 )
	{
		$data = static::where( 'parent_id' , $parentId )->select();
		foreach ($data as $key => $value) {
			$tem = static::getMenuList( $value[ 'id' ] );
			if( count( $tem ) > 0 ){
				$value [ 'children' ] = $tem;
				$data [ $key ] = $value;
			}
		}
		return $data;
	}



}